<template>
	<view>
		<v-tabs activeColor="#0F0F0F" lineColor="#000000" lineHeight="5rpx" lineScale="0.5" :scroll="false"
			v-model="current" :tabs="tabs" @change="changeTab"></v-tabs>
		<view class="main">
			<view v-if="current==0">
				<view class="tit"><text>*</text>任务名</view>
				<input v-model="obj1.title" placeholder="任务名" />
				<view class="tit"><text>*</text>视频描述</view>
				<textarea v-model="obj1.video_text" placeholder="请输入简单描述，可为空，每行一句描述"></textarea>
				<view class="tips">注：每行一个描述，随机取，建议每行30个字左右</view>
				<view class="tit"><text></text>话题挂载（秒）</view>
				<!-- <lxt-selects :partlist="columns1" placeholder="选择2-5个长尾关键词" :disabled="false"
					v-model="obj1.video_text_keyword_text" @transfer="getUser">
				</lxt-selects> -->
				<!-- <input v-model="value" placeholder="选择2-5个长尾关键词" disabled @click="toShow(1)"/> -->
				<!-- <input v-model="value" placeholder="请选择关键词分组" style="margin-top: 20rpx;" /> -->
				<view>
					<lxt-selects :partlist="columns2" placeholder="请选择关键词分组" :disabled="false"
						v-model="obj1.keyword_group_ids_text" @transfer="getUser2">
					</lxt-selects>
				</view>
				<view class="tips">用于排名，如未添加关键词，请先添加长尾关键词</view>
				<view class="tit"><text></text>发送用户</view>
				<view>
					<jade-checkbox v-model="obj1.tuiguang_user_id" :list="list" :title="checkTitle"
						@change="changeCheckbox"></jade-checkbox>
					<view style="max-height: 600rpx;overflow: auto;">
						<uni-data-checkbox mode="list" :map="map" multiple v-model="obj1.tuiguang_user_id"
							:localdata="list" />
					</view>
				</view>
				<view class="tit"><text></text>账号分组</view>
				<lxt-selects :partlist="columns3" placeholder="选择分组账号" :disabled="false" v-model="obj1.group_ids_text"
					@transfer="getUser3">
				</lxt-selects>
				<!-- <input v-model="value" placeholder="选择分组账号" /> -->
				<view class="tips">与发送用户二选一，或者两者搭配使用</view>
				<view class="tit"><text></text>快手封面(必填)</view>
				<input v-model="obj1.cover_img" placeholder="请上传" disabled />
				<shmily-drag-image :delImage="delImage" v-model="imgArr" keyName="url"
					v-if="imgArr.length!=0"></shmily-drag-image>
				<view class="tips">快手允许视频封面，其他平台上传封面无效;</view>
				<view class="flex align between btns">
					<view class="flex btn-item1" @click="toUploadImg()">
						<uni-icons type="upload" size="20" color="#fff"></uni-icons>
						<text>上传</text>
					</view>
					<view class="flex btn-item2" @click="toUrl(1)"><uni-icons type="list" size="20"
							color="#fff"></uni-icons>
						<text>选择</text>
					</view>
				</view>
				<view class="tit"><text></text>手动上传视频</view>
				<input v-model="obj1.tuiguang_video_list" disabled placeholder="请上传" />
				<shmily-drag-image :delImage="delImage2" v-model="imgVideoArr" keyName="url"
					v-if="imgVideoArr.length!=0"></shmily-drag-image>
				<view class="tips">视频格式支持：MP4、ogg、WebM、mov ;</view>
				<view class="flex align between btns">
					<view class="flex btn-item1" @click="toUpload()">
						<uni-icons type="upload" size="20" color="#fff"></uni-icons>
						<text>上传</text>
					</view>
					<view class="flex btn-item2" @click="toUrl(2)"><uni-icons type="list" size="20"
							color="#fff"></uni-icons>
						<text>选择</text>
					</view>
				</view>
				<view class="tit"><text></text>选择视频分组</view>
				<!-- <input v-model="value" placeholder="请选择" /> -->
				<lxt-selects :partlist="columns4" placeholder="选择视频分组" :disabled="false"
					v-model="obj1.tuiguang_video_groups_text" @transfer="getUser4">
				</lxt-selects>
				<view class="tips">与手动上传视频、视频分组三选一，或者搭配使用</view>
				<!-- <view class="tit"><text></text>视频分组</view>
				<input v-model="value" placeholder="请选择" /> -->
				<!-- <view class="tips">与手动上传视频、视频分组三选一，或者搭配使用</view> -->
				<!-- <view class="tit"><text></text>哔哩视频类型分类</view> -->
				<!-- <input v-model="obj1.bili_tid_text" placeholder="生活-日常" @click="toShow(1)" disabled /> -->
				<!-- <view class="tips">哔哩哔哩必选分类，否则发布失败，其他平台不生效</view> -->
				<view class="tit"><text>*</text>挂载类型</view>
				<view class="checkbox">
					<uni-data-checkbox v-model="obj1.type" :localdata="range1" @change="change"></uni-data-checkbox>
				</view>
				<view class="tips">挂载功能仅支持抖音;</view>
				<view class="tit"><text></text>挂载poi地址</view>
				<input v-model="obj1.poi_address" placeholder="请输入" />
				<view class="tips">
					<view>例如:https:/v.douyin.com/8RE9Xe5/此功能强烈建议使用，</view>
					<view>可使视频得到更大曝光度</view>
					<view>从抖音app搜索栏搜索地点，获取地址分享链接，</view>
					<view>例如：https://v.douyin.com/MnXe3S4/</view>
				</view>
				<!-- <view class="tit"><text></text>poi地址名称(地址挂载必填)</view> -->
				<!-- <input v-model="obj1.poi_name" placeholder="例如:广州酒家(荔胜广场店)" /> -->
				<view class="tit"><text></text>@用户</view>
				<input v-model="obj1.alias" placeholder="请输入需要艾特的openid 或者 用户抖音链接" />
				<view class="tips">
					<view>注意：新老接口请勿一起勾选发送，否则会导致艾特用户失效</view>
					<view>1、抖音开放平台：前往矩阵号复制openid，例如：_000lO23tTIiDBRRtiOnL</view>
					<view>2、抖音老接口：输入想要艾特的D音主页链接，可输入pc主页 </view>
					<view>或者 app主页分享链接，</view>
					<view>例如：例如：https://www.douyin.com/user/MS4wLjABAAAAWBxjAMa</view>
				</view>
				<view class="tit"><text></text>发送时间</view>
				<view class="checkbox">
					<uni-data-checkbox v-model="obj1.send_type" :localdata="range7"></uni-data-checkbox>
				</view>
				<!-- 定时时间 -->
				<view v-if="obj1.send_type==2">
					<view class="tit"><text></text>定时时间</view>
					<input placeholder="请选择" disabled v-model="obj1.send_time" @click="show2 = true" />
				</view>
				<view class="tit"><text></text>视频去重</view>
				<view class="checkbox">
					<uni-data-checkbox v-model="obj1.is_repeat" :localdata="range2"></uni-data-checkbox>
				</view>
				<view class="tips">选择允许重复视频时，会按视频最少发送次数的视频优先发送；</view>
				<view class="tit"><text></text>视频内容同步</view>
				<view class="checkbox">
					<uni-data-checkbox v-model="obj1.is_tongyi_value" multiple :localdata="range3"
						@change="changeTong"></uni-data-checkbox>
				</view>
				<view class="tips">勾选即代表你同意该次本软件发送视频到你的抖音账号上；
					在本软件删除视频，视频在抖音仍可见，
					要删除同步在抖音的视频，请前往抖音app操作</view>
			</view>
			<view v-if="current==1">
				<view class="tit"><text>*</text>任务名</view>
				<input v-model="obj1.title" placeholder="任务名" />
				<view class="tit"><text>*</text>视频描述</view>
				<textarea v-model="obj1.video_text" placeholder="请输入简单描述，可为空，每行一句描述"></textarea>
				<view class="tips">注：每行一个描述，随机取，建议每行30个字左右</view>
				<view class="tit"><text></text>话题挂载（秒）</view>
				<!-- <lxt-selects :partlist="columns1" placeholder="选择2-5个长尾关键词" :disabled="false"
					v-model="obj1.video_text_keyword_text" @transfer="getUser">
				</lxt-selects> -->
				<!-- <input v-model="value" placeholder="选择2-5个长尾关键词" disabled @click="toShow(1)"/> -->
				<!-- <input v-model="value" placeholder="请选择关键词分组" style="margin-top: 20rpx;" /> -->
				<view>
					<lxt-selects :partlist="columns2" placeholder="请选择关键词分组" :disabled="false"
						v-model="obj1.keyword_group_ids_text" @transfer="getUser2">
					</lxt-selects>
				</view>
				<view class="tips">用于排名，如未添加关键词，请先添加长尾关键词</view>
				<view class="tit"><text></text>发送用户</view>
				<view>
					<jade-checkbox v-model="obj1.tuiguang_user_id" :list="list" :title="checkTitle"
						@change="changeCheckbox"></jade-checkbox>
					<view style="max-height: 600rpx;overflow: auto;">
						<uni-data-checkbox mode="list" :map="map" multiple v-model="obj1.tuiguang_user_id"
							:localdata="list" />
					</view>
				</view>
				<view class="tit"><text></text>内容发布</view>
				<view class="flex align" style="font-size: 24rpx;">
					<view>每</view>
					<input style="background: white;width: 100rpx;padding: 5rpx;margin: 0 10rpx;" type="digit"
						v-model="obj1.rand_photos_num" placeholder="请输入" />
					<view>张图片为一个内容发布</view>
				</view>
				<view class="tips">从上传图片中随机抽取设置数图片为一个内容发布 0表示全部选择</view>
				<view class="tit"><text></text>账号分组</view>
				<lxt-selects :partlist="columns3" placeholder="选择分组账号" :disabled="false" v-model="obj1.group_ids_text"
					@transfer="getUser3">
				</lxt-selects>
				<!-- <input v-model="value" placeholder="选择分组账号" /> -->
				<view class="tips">与发送用户二选一，或者两者搭配使用</view>
				<view class="tit"><text></text>组图(必填)</view>
				<input v-model="obj1.cover_img" placeholder="请上传" disabled />
				<shmily-drag-image :delImage="delImage2" v-model="imgVideoArr" keyName="url"
					v-if="imgVideoArr.length!=0"></shmily-drag-image>
				<view class="tips">视频格式支持：MP4、ogg、WebM、mov ;</view>
				<view class="flex align between btns">
					<view class="flex btn-item1" @click="toUpload()">
						<uni-icons type="upload" size="20" color="#fff"></uni-icons>
						<text>上传</text>
					</view>
					<view class="flex btn-item2" @click="toUrl(3)"><uni-icons type="list" size="20"
							color="#fff"></uni-icons>
						<text>选择</text>
					</view>
				</view>
				<view class="tit"><text>*</text>挂载类型</view>
				<view class="checkbox">
					<uni-data-checkbox v-model="obj1.type" :localdata="range1" @change="change"></uni-data-checkbox>
				</view>
				<view class="tips">挂载功能仅支持抖音;</view>
				<view class="tit"><text></text>挂载poi地址</view>
				<input v-model="obj1.poi_address" placeholder="请输入" />
				<view class="tips">
					<view>例如:https:/v.douyin.com/8RE9Xe5/此功能强烈建议使用，</view>
					<view>可使视频得到更大曝光度</view>
					<view>从抖音app搜索栏搜索地点，获取地址分享链接，</view>
					<view>例如：https://v.douyin.com/MnXe3S4/</view>
				</view>
				<!-- <view class="tit"><text></text>poi地址名称(地址挂载必填)</view> -->
				<!-- <input v-model="obj1.poi_name" placeholder="例如:广州酒家(荔胜广场店)" /> -->
				<view class="tit"><text></text>@用户</view>
				<input v-model="obj1.alias" placeholder="请输入需要艾特的openid 或者 用户抖音链接" />
				<view class="tips">
					<view>注意：新老接口请勿一起勾选发送，否则会导致艾特用户失效</view>
					<view>1、抖音开放平台：前往矩阵号复制openid，例如：_000lO23tTIiDBRRtiOnL</view>
					<view>2、抖音老接口：输入想要艾特的D音主页链接，可输入pc主页 </view>
					<view>或者 app主页分享链接，</view>
					<view>例如：例如：https://www.douyin.com/user/MS4wLjABAAAAWBxjAMa</view>
				</view>
				<view class="tit"><text></text>发送时间</view>
				<view class="checkbox">
					<uni-data-checkbox v-model="obj1.send_type" :localdata="range7"></uni-data-checkbox>
				</view>
				<!-- 定时时间 -->
				<view v-if="obj1.send_type==2">
					<view class="tit"><text></text>定时时间</view>
					<input placeholder="请选择" disabled v-model="obj1.send_time" @click="show2 = true" />
				</view>
			</view>
			<view class="subBtn" @click="toSubmit()">确定</view>
			<!-- <button form-type="submit" class="subBtn">确定</button> -->
		</view>
		<!-- 话题挂载（关键字） -->
		<u-picker :show="show1" :columns="columns" keyName="name" @cancel="show1 = false"
			@confirm="confirm1"></u-picker>
		<!-- 定时时间 -->
		<u-datetime-picker :show="show2" v-model="dateValue" mode="datetime" @cancel="show2 = false"
			@confirm="confirmTime"></u-datetime-picker>
	</view>
</template>

<script>
	import {
		uploadOss
	} from '@/until/oss/oss.js';
	import {
		mergeKeywordIndex,
		mergeKeywordGroupIndex,
		tuiguangUserGroupIndex,
		tuiguangVideoGroup,
		tuiguangPageUser
	} from '@/api/apiData.js';
	import {
		storeCardAdd,
		aliossNotify,
		tuiguangTaskAdd,
		tuiguangTaskPhotosAdd
	} from '@/api/apiData.js';
	import {
		getFormatTime
	} from '@/until/until.js';
	export default {
		data() {
			return {
				map: {
					text: 'name',
					value: 'value'
				},
				checkTitle: '全选/反选',
				list: [
					// {
					// 	id: 578,
					// 	value: 578,
					// 	nickname: '红出圈1号',
					// 	name: '红出圈1号',
					// 	head: "https://p3.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813c001_oUKKYAb3CFQA4x9AAEgsI2eDenA1AmpQnrAOCM.jpeg?from=4010531038"
					// },
					// {
					// 	id: 300,
					// 	value: 300,
					// 	nickname: '红出圈2号',
					// 	name: '红出圈2号',
					// 	head: "https://p3.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813c001_oUKKYAb3CFQA4x9AAEgsI2eDenA1AmpQnrAOCM.jpeg?from=4010531038"
					// },
					// {
					// 	id: 400,
					// 	value: 400,
					// 	nickname: '红出圈3号',
					// 	name: '红出圈3号',
					// 	head: "https://p3.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813c001_oUKKYAb3CFQA4x9AAEgsI2eDenA1AmpQnrAOCM.jpeg?from=4010531038"
					// }
				],
				package_ids: [],
				dateValue: Number(new Date()),
				value1: '',
				value2: '',
				slider1: 10,
				current: 0,
				slider2: 0,
				tabs: ['视频发布', '组图发布'],
				check: 0,
				check3: 0,
				range1: [{
					"value": 1,
					"text": "POI地址挂载"
				}],
				range2: [{
					"value": 1,
					"text": "去重"
				}, {
					"value": 2,
					"text": "允许发重复视频"
				}],
				show1: false,
				show2: false,
				columns: [
					[{
						name: '生活 - 搞笑',
						value: '138'
					}]
				],
				columns1: [],
				columns2: [],
				columns3: [],
				columns4: [],
				range3: [{
					"value": 0,
					"text": " 同步到抖音"
				}],
				range4: [{
					"value": 0,
					"text": "开启"
				}, {
					"value": 1,
					"text": "关闭"
				}],
				range5: [{
					"value": 0,
					"text": "开启"
				}, {
					"value": 1,
					"text": "关闭"
				}],
				range6: [{
					"value": 0,
					"text": "开启"
				}, {
					"value": 1,
					"text": "关闭"
				}],
				range7: [{
					"value": 1,
					"text": "立即发送"
				}, {
					"value": 2,
					"text": "指定时间"
				}],
				obj1: { //视频发布
					title: '', //任务名
					video_text: '', //视频描述
					video_text_keyword: '', //话题挂载
					video_text_keyword_text: '',
					keyword_group_ids: '', //话题挂载分组
					keyword_group_ids_text: '',
					group_ids: '', //账号分组
					group_ids_text: '', //账号分组
					cover_img: '', //快手封面
					tuiguang_video_list: '', //手动上传视频
					make_video_ids: '', //剪辑任务视频
					make_video_ids_text: '', //剪辑任务视频
					tuiguang_video_groups: '', //手动上传视频分组
					tuiguang_video_groups_text: '', //手动上传视频分组
					bili_tid: '', //哔哩分类
					bili_tid_text: '', //哔哩分类
					type: 1, //挂载类型1
					poi_address: '', //挂载poi地址
					poi_name: '', //poi地址名称(地址挂载必填)
					alias: '', //@用户
					send_type: 1, //发送时间1
					is_repeat: 2, //视频去重1
					is_tongyi: 'no', //视频内容同步1
					is_tongyi_value: [0],
					rand_photos_num: 0,
					send_time: '',
					tuiguang_user_id: [],
					photos: ''
				},
				obj2: {
					title: '', //任务名
					video_text: '', //任务描述
					video_text_keyword: '', //话题挂载
					video_text_keyword_text: '',
					keyword_group_ids: '', //话题挂载分组
					keyword_group_ids_text: '',
					rand_photos_num: '', //内容发布1
					group_ids: '', //账号分组
					group_ids_text: '', //账号分组
					photos: '', //组图
					type: '', //挂载类型
					poi_address: '', //挂载poi地址
					poi_name: '', //poi地址名称(地址挂载必填)
					alias: '', //@用户
					send_type: 1, //发送时间1
					IDs: ''
				},
				imgArr: [],
				imgVideoArr: [],
				userList: [{
						id: 578,
						nickname: '红出圈1号',
						head: "https://p3.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813c001_oUKKYAb3CFQA4x9AAEgsI2eDenA1AmpQnrAOCM.jpeg?from=4010531038"
					},
					{
						id: 300,
						nickname: '红出圈2号',
						head: "https://p3.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813c001_oUKKYAb3CFQA4x9AAEgsI2eDenA1AmpQnrAOCM.jpeg?from=4010531038"
					},
					{
						id: 400,
						nickname: '红出圈3号',
						head: "https://p3.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813c001_oUKKYAb3CFQA4x9AAEgsI2eDenA1AmpQnrAOCM.jpeg?from=4010531038"
					}
				],
				formItems: [{
						value: ''
					},
					{
						value: ''
					},
					// 可以根据需要添加更多的表单项
				]
			};
		},
		onShow() {
			if (uni.getStorageSync('image')) {
				this.imgArr = uni.getStorageSync('image')
				let arr = []
				this.imgArr.forEach((item => {
					arr.push(item.url)
				}))
				this.obj1.cover_img = arr.toString()
			}
			if (uni.getStorageSync('imgVideoArr')) {
				this.imgVideoArr = uni.getStorageSync('imgVideoArr')
				let arr = []
				this.imgVideoArr.forEach((item => {
					arr.push(item.url)
				}))
				this.obj1.tuiguang_video_list = arr.toString()
			}
		},
		onLoad() {
			this.getGroup1()
			this.getUserList()
		},
		methods: {
			async getUserList(){
				const result = await tuiguangPageUser()
				result.data.data.forEach(item=>{
					item.value = item.id
					item.name = item.nickname
				})
				this.list = result.data.data
			},
			formSubmit(e) {
				// e.preventDefault(); // 阻止表单默认提交行为
				var formdata = e.detail.value
				console.log(formdata)
				uni.request({
					url: 'https://jzxt.jiugezixun.cn/storeadmin/tuiguang_task/add',
					data: formdata,
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'X-Requested-With': 'XMLHttpRequest',
						'Cookie': uni.getStorageSync('cookies') // 从存储中读取cookies并设置到请求头
					},
					success: result => {
						if (result.data.code == 1) {

						} else {
							uni.showToast({
								title: result.data.msg,
								icon: 'none'
							})
						}
					},
					fail: result => {
						uni.hideLoading();
					}
				})
			},
			changeCheckbox(e) {
				console.log(e)
				this.obj1.tuiguang_user_id = e
			},

			confirmTime(e) {
				this.obj1.send_time = getFormatTime(e.value)
				this.show2 = false
			},
			changeTong(e) {
				if (e.detail.data.length != 0) {
					this.obj1.is_tongyi = 'no'
				} else {
					this.obj1.is_tongyi = ''
				}
			},
			confirm1(e) {
				console.log(e)
				this.obj1.bili_tid = e.value[0].value
				this.obj1.bili_tid_text = e.value[0].name
				this.show1 = false
			},
			delImage2(done) {
				let that = this
				uni.showModal({
					content: '是否删除?',
					success: (res) => {
						if (res.confirm) {
							// 执行 done() 删除

							done()
							let arr = []
							that.imgVideoArr.forEach((item => {
								arr.push(item.url)
							}))
							that.obj1.tuiguang_video_list = arr.toString()
							uni.setStorageSync('imgVideoArr', that.imgVideoArr);
						}
					}
				})
			},
			toUrl(n) {
				if (n == 1) {
					uni.navigateTo({
						url: '/pages/material/material?type=1&type2=2'
					})
				}
				if (n == 2) {
					uni.navigateTo({
						url: '/pages/material/material?type=2'
					})
				}
				if (n == 3) {
					uni.navigateTo({
						url: '/pages/material/material?type=1'
					})
				}

			},
			// 上传视频/图片
			toUpload() {
				let that = this
				uni.chooseMedia({
					count: 9,
					mediaType: ['video'],
					sourceType: ['camera', 'album'], //从相册选择
					success: (res) => {
						console.log(res)
						let fileArr = res.tempFiles
						let length = fileArr.length
						fileArr.forEach((item, index) => {
							console.log(item.tempFilePath)
							that.toOss(item.tempFilePath, index, item.fileType, item.size, new Date()
								.getTime())
						})
					},
					fail() {
						uni.hideLoading()
					}
				})
			},
			// 上传图片
			toUploadImg() {
				let that = this
				uni.showLoading({
					title: "loading",
					mask: true
				})
				uni.chooseMedia({
					count: 1,
					mediaType: ['image'],
					sizeType: ['original'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['camera', 'album'], //从相册选择
					success: (res) => {
						console.log(res)
						// OSS上传(得到在oss文件夹下照片路径)
						let fileArr = res.tempFiles
						let length = fileArr.length

						fileArr.forEach((item, index) => {
							that.toOss(item.tempFilePath, index, item.fileType, item.size, new Date()
								.getTime())
						})
					},
					fail() {
						uni.hideLoading()
					}
				})
			},
			async toOss(item, index, fileType, size, name) {
				const time = uni.$u.timeFormat(new Date().getTime(), 'yyyymm/dd')
				let ossPath = await uploadOss({
					filePathFore: time + '/',
					filePath: item,
				})
				let url = 'https://hongchuquan.oss-cn-shanghai.aliyuncs.com/' + ossPath
				if (fileType == 'image') {
					this.obj1.cover_img = url
					this.imgArr = [{
						type: 'image',
						url: url
					}]
				}
				if (fileType == 'video') {
					let arr = [{
						type: fileType,
						url: url
					}]
					this.imgVideoArr = this.imgVideoArr.concat(arr)
					let arrs = []
					this.imgVideoArr.forEach((item => {
						arrs.push(item.url)
					}))
					this.obj1.tuiguang_video_list = arrs.toString()
					uni.setStorageSync('imgVideoArr', this.imgVideoArr);
				}
				// this.toComf(url, fileType, size, name)
			},
			async toComf(url, fileType, size, name) {
				uni.showLoading({
					title: "loading",
					mask: true
				})
				const result = await aliossNotify({
					url: url,
					name: name,
					size: size,
					type: fileType,
				})
				if (result.code == 1) {
					uni.hideLoading()
					uni.showToast({
						title: '上传成功'
					})
				} else {
					uni.hideLoading()
					uni.showToast({
						title: result.msg,
						icon: 'error'
					})
				}
			},
			delImage(done) {
				let that = this
				uni.showModal({
					content: '是否删除?',
					success: (res) => {
						if (res.confirm) {
							// 执行 done() 删除
							done()
							let arr = []
							that.imgArr.forEach((item => {
								arr.push(item.url)
							}))
							that.obj1.cover_img = arr.toString()
						}
					}
				})
			},
			getUser(msg) {
				this.obj1.video_text_keyword = msg
			},
			getUser2(msg) {
				this.obj1.keyword_group_ids = msg
			},
			getUser3(msg) {
				this.obj1.group_ids = msg
			},
			getUser4(msg) {
				this.obj1.tuiguang_video_groups = msg
			},
			toShow(n) {
				if (n == 1) {
					this.show1 = true
					this.getGroup2()
				}

			},
			getGroup2() {
				let that = this
				uni.request({
					url: 'http://jzxt.jiugezixun.cn/index.php/miniprogram/index/index',
					method: 'POST',
					proxy: 'http://douyin.ttbp,vip/api/xiaozhu/get_bili_type',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'X-Requested-With': 'XMLHttpRequest',
						'X-Proxy-Url': 'http://douyin.ttbp.vip/api/xiaozhu/get_bili_type',
						'Cookie': uni.getStorageSync('cookies') // 从存储中读取cookies并设置到请求头
					},
					success: result => {
						console.log(result)
						if (result.data.code == 1) {
							result.data.data.result.forEach(item => {
								item.name = item.parent_name + '-' + item.name
								item.value = item.tid
							})
							that.columns = [result.data.data.result]
						} else {
							uni.showToast({
								title: result.data.msg,
								icon: 'none'
							})
						}
					},
					fail: result => {
						uni.hideLoading();
					}
				})
			},
			async getGroup1() {
				const result = await mergeKeywordIndex()
				const result2 = await mergeKeywordGroupIndex()
				const result3 = await tuiguangUserGroupIndex()
				const result4 = await tuiguangVideoGroup()
				result.rows.forEach(item => {
					item.value = item.id
					item.text = item.merge_keyword
					item.active = false
				})
				result2.rows.forEach(item => {
					item.value = item.id
					item.text = item.name
					item.active = false
				})
				result3.rows.forEach(item => {
					item.value = item.id
					item.text = item.name
					item.active = false
				})
				result4.rows.forEach(item => {
					item.value = item.id
					item.text = item.name
					item.active = false
				})
				this.columns1 = result.rows
				this.columns2 = result2.rows
				this.columns3 = result3.rows
				this.columns4 = result4.rows
			},
			changeTab(index) {
				console.log('当前选中的项：' + index)
				this.current = index
				uni.removeStorageSync('image')
				uni.removeStorageSync('imgVideoArr')
				this.imgArr = []
				this.obj1.cover_img = ''
				this.imgVideoArr = []
				this.obj1.tuiguang_video_list = ''
			},
			confirm(e) {
				console.log(e)
			},
			async toSubmit() {
				let obj1 = {
					'row[title]': this.obj1.title,
					'row[video_text]': this.obj1.video_text,
					'row[video_text_keyword]': this.obj1.video_text_keyword,
					'row[video_text_keyword]_text': this.obj1.video_text_keyword_text,
					'row[make_video_ids]': this.obj1.make_video_ids,
					'row[make_video_ids]_text': this.obj1.make_video_ids_text,
					'row[tuiguang_video_groups]': this.obj1.tuiguang_video_groups,
					'row[tuiguang_video_groups]_text': this.obj1.tuiguang_video_groups_text,
					'row[keyword_group_ids]': this.obj1.keyword_group_ids,
					'row[keyword_group_ids]_text': this.obj1.keyword_group_ids_text,
					'row[group_ids]': this.obj1.group_ids,
					'row[group_ids]_text': this.obj1.group_ids_text,
					'row[bili_tid]': this.obj1.bili_tid,
					'row[bili_tid]_text': this.obj1.bili_tid_text,
					'tuiguang_user_id': this.obj1.tuiguang_user_id,
					'rand_photos_num': this.obj1.rand_photos_num,
					'row[photos]': this.obj1.photos,
					'row[cover_img]': this.obj1.cover_img,
					'type': this.obj1.type,
					'row[poi_address]': this.obj1.poi_address,
					'row[poi_name]': this.obj1.poi_name,
					'row[alias]': this.obj1.alias,
					'send_type': this.obj1.send_type,
					'row[send_time]': this.obj1.send_time,
					'is_repeat': this.obj1.is_repeat,
					'is_tongyi': this.obj1.is_tongyi,
					'row[tuiguang_video_list]': this.obj1.tuiguang_video_list,
				}
				let obj2 = {
					'row[title]': this.obj1.title,
					'row[video_text]': this.obj1.video_text,
					'row[video_text_keyword]': this.obj1.video_text_keyword,
					'row[video_text_keyword]_text': this.obj1.video_text_keyword_text,
					'row[keyword_group_ids]': this.obj1.keyword_group_ids,
					'row[keyword_group_ids]_text': this.obj1.keyword_group_ids_text,
					'row[group_ids]': this.obj1.group_ids,
					'row[group_ids]_text': this.obj1.group_ids_text,
					'tuiguang_user_id': this.obj1.tuiguang_user_id,
					'rand_photos_num': this.obj1.rand_photos_num,
					'row[photos]': this.obj1.cover_img,
					'type': this.obj1.type,
					'row[poi_address]': this.obj1.poi_address,
					'row[poi_name]': this.obj1.poi_name,
					'row[alias]': this.obj1.alias,
					'send_type': this.obj1.send_type,
					'row[send_time]': this.obj1.send_time,
					'is_tongyi': this.obj1.is_tongyi
				}
				console.log('obj1：')
				console.log(obj1)
				console.log('obj2：')
				console.log(obj2)
				if (this.obj1.title == '') {
					uni.showToast({
						title: '请输入任务名',
						icon: 'none'
					})
					return false
				}
				if (this.obj1.video_text == '') {
					uni.showToast({
						title: '请输入视频描述',
						icon: 'none'
					})
					return false
				}
				if (this.current == 0) {

					const result = await tuiguangTaskAdd(obj1)
					if (result.code == 1) {
						uni.showToast({
							title: '发布成功'
						})
						setTimeout(() => {
							uni.navigateBack()
							uni.removeStorageSync('images')
							uni.removeStorageSync('imgVideoArr')
						})
					} else {
						uni.showToast({
							title: result.msg,
							icon: 'none'
						})
					}
				}
				if (this.current == 1) {
					const result = await tuiguangTaskPhotosAdd(obj2)
					if (result.code == 1) {
						uni.showToast({
							title: '发布成功'
						})
						setTimeout(() => {
							uni.navigateBack()
							uni.removeStorageSync('images')
							uni.removeStorageSync('imgVideoArr')
						})
					} else {
						uni.showToast({
							title: result.msg,
							icon: 'none'
						})
					}
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.top-img {
		width: 100%;
		height: 422rpx;
	}

	.main {
		margin-top: 15rpx;
		background: white;
		padding: 7rpx 30rpx;

		.title {
			font-size: 32rpx;
			font-weight: bold;
		}

		.tit {
			font-size: 28rpx;
			margin: 17rpx 0;
			font-weight: bold;

			text {
				color: #FF0000;
			}
		}

		input {
			padding: 14rpx 15rpx;
			font-size: 20rpx;
			border: solid 1rpx #707070;
			border-radius: 10rpx;
		}

		.btns {
			margin: 20rpx 40rpx;

			view {
				width: 250rpx;
				height: 60rpx;
				line-height: 60rpx;
				border-radius: 10rpx;
				justify-content: center;
				color: white;
				text-align: center;
			}

			.btn-item1 {
				background: #DD4E3D;
			}

			.btn-item2 {
				background: #5D9CEB;
			}

			text {
				margin-left: 10rpx;
			}
		}

		.btns2 {
			margin: 20rpx 0;

			view {
				width: 200rpx;
			}
		}

		.tips {
			font-size: 20rpx;
			margin: 15rpx 0;
		}

		.slider {
			font-size: 20rpx;

			.slider-tips {
				font-size: 20rpx;
				position: absolute;
				bottom: 0;
				left: 30rpx;
			}
		}

		.subBtn {
			font-size: 30rpx;
			color: white;
			padding: 8rpx 95rpx;
			background: #5D9CEB;
			width: fit-content;
			margin: 137rpx auto;
			border-radius: 10rpx;
		}

		textarea {
			border: solid 1rpx #707070;
			padding: 15rpx 9rpx;
			border-radius: 10rpx;
			font-size: 20rpx;
		}

		.change {
			input {
				width: 80%;
			}

			view {
				width: 44rpx;
				height: 44rpx;
				border: solid 8rpx #E0E0E0;
				background: white;
				border-radius: 4rpx;
			}
		}
	}
</style>